<?php
namespace app\home\controller;

use app\common\component\notice\NoticeService;

class Notice extends ControllerBase {
	public function index() {
		$this -> view -> assign('notices', (new NoticeService) -> getNotices(10, true));

		return $this -> view -> fetch();
	}

	public function detail() {
		$resultNotice = (new NoticeService) -> getNotice($this -> request -> get('notice_id', 0, 'int'));
		if($resultNotice['code'] == 0) {			
			$this -> view -> assign('notice', $resultNotice['data']['notice']);
		}

		return $this -> view -> fetch();
	}
}